

import javax.swing.*;
import java.io.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.UIManager;

class Ingress_Frame // implements Runnable
{
	JFrame Ing_fra;
	Container cp1;
	int tot;
	JTextArea Ing_data = new JTextArea();
	JTextField InTxt;
	JButton OutTxt = new JButton();
	JLabel InPac, OutPac;
	String instring = "";
	static int length = 0;
	static int length1 = 0;
	static String s = "";
	static String s1 = "";
	static int I = 0;
	String fin = "";
	static String dest = "";
	static String sou = "";
	boolean sta = true;
	static int inp = 0, outp = 0;
	JScrollPane jsp;
	BufferedReader in1;
	OutputStream out;
	int readcnt = 0;
	static String text;
	String egg = "";
	static String text1;
	char chstr[] = new char[512];
	long l;
	String inf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
	int port_number;
	
	public Ingress_Frame() {
		super();
		
	}



	public void dis_ing_fra(int port_number) {
		Ing_fra = new JFrame("Router "+port_number);
		cp1 = Ing_fra.getContentPane();
		cp1.setLayout(null);
		//InPac = new JLabel("INCOMING PACKETS :");
		//OutPac = new JLabel("OUTGOING PACKETS :");
		//InTxt = new JTextField();
		//InTxt.setText("0");
		OutTxt.setText("send");
		//InPac.setForeground(Color.blue);
		//OutPac.setForeground(Color.blue);
		Ing_data.setEditable(false);
		//InTxt.setEditable(false);
		Ing_data.setBorder(BorderFactory.createEtchedBorder(Color.black,
				Color.black));
		//InTxt.setBorder(BorderFactory.createEtchedBorder(Color.black,
				//Color.black));
		//OutTxt.setBorder(BorderFactory.createEtchedBorder(Color.black,
			//	Color.black));
		jsp = new JScrollPane(Ing_data);
		cp1.add(jsp);
		//cp1.add(InPac);
		//cp1.add(InTxt);
		//cp1.add(OutPac);
		//cp1.add(OutTxt);
		jsp.setBounds(5, 5, 470, 400);
		//InPac.setBounds(5, 425, 130, 25);
		//InTxt.setBounds(125, 425, 75, 25);
		//OutPac.setBounds(250, 425, 150, 25);
		//OutTxt.setBounds(375, 425, 75, 25);
		Ing_fra.setBounds(5, 5, 500, 500);
		OutTxt.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
			
					sendButton(e);
				
				
			}
		});
		Ing_fra.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		try {
			UIManager.setLookAndFeel(inf);
			SwingUtilities.updateComponentTreeUI(Ing_fra);
		} catch (Exception e) {
			e.printStackTrace();
		}
		Ing_fra.setVisible(true);
	}



	protected void sendButton(ActionEvent e)  {
		System.out.println("send button is pressed");
			}

}
